﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;
using ThangNM_LIB.FUNC;

namespace CSharp
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            ////URLRewriter.sRoot = CSharp.Properties.Settings.Default.Root;
            //URLRewriter.bSyncMapUrl = true;
            //URLRewriter.RegisterRoutes(null, null);

            //System.Timers.Timer myTimer = new System.Timers.Timer();
            //myTimer.Interval = 20000; // Set the Interval to 5 seconds (5000 milliseconds).
            //myTimer.AutoReset = true;
            //myTimer.Elapsed += new System.Timers.ElapsedEventHandler(URLRewriter.RegisterRoutes);
            //myTimer.Enabled = true;

            RegisterRoutes(RouteTable.Routes);
            

        }

        static void RegisterRoutes(RouteCollection routes)
        {
            //routes.Add(new Route("resource/{sRID}", new Resource()));
            routes.MapPageRoute("Admin", "ad", "~/Admin/AccessUI.aspx");
            routes.MapPageRoute("HotDeal", "hotdeal", "~/HotDealUI.aspx");
            routes.MapPageRoute("HotDeal_Short", "nmt/{sSID}", "~/HotDeal.aspx");
            routes.MapPageRoute("Hotdeal_Full", "hotdeal/{sTitle}-{sSID}", "~/HotDeal.aspx");
            
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {
        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}